angular.module('webmac',['webmac.service','mgcrea.ngStrap','ui.router','ngAnimate'])
.config(function($stateProvider,jconfig, $urlRouterProvider,$locationProvider) {
	// For any unmatched url, redirect to /state1

	$urlRouterProvider.otherwise('/');
	$locationProvider.html5Mode(true).hashPrefix('!');
	// Now set up the states
	$stateProvider
		.state('os', {
			url: "/",
			templateUrl: "view/index.html",
			controller:'osCtrl'
		})

		.state('boot', {
			url: "/boot",
			templateUrl: "view/boot.html",
			controller:'osBootCtrl'
		})

		.state('login', {
			url: "/login",
			templateUrl: "view/login.html",
			controller:'osLoginCtrl'
		})

		.state('desktop', {
			url: "/desktop",
			templateUrl: "view/desktop.html",
			controller:'osDesktopCtrl'
		})

		;
})
.run(function($rootScope,$state,$aside,jconfig,$timeout,$jd){

		$rootScope.$on('$stateChangeStart',function(event, toState, toParams, fromState, fromParams){
			if(toState.title){
				$rootScope.title=toState.title;
			}

			$rootScope.current_nav = toState.name;

		});
});


$(function(){
    $('#appMenu').appMenu({
        reorder: false,
        showControl: true,
        // debug:       true,
        showControlText : '用alt+tab 切换已经打开的应用',
        updateHash: false,
        onSelect: function(obj, options) {
            var itemTarget = obj;
            $('div[opened="#'+obj+'"]').trigger('dblclick');
        }
    });
})

